home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / Collection.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.3 KB  |  93 lines

  1. /* Interface for Objective-C Collection object
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. /* This is the abstract superclass that satisfies the Collecting
  25.    protocol, without using any instance variables.
  26. */
  27.  
  28. #ifndef __Collection_h_INCLUDE_GNU
  29. #define __Collection_h_INCLUDE_GNU
  30.  
  31. #include <objects/stdobjects.h>
  32. #include <objc/Object.h>
  33. #include <objects/Collecting.h>
  34. #include <objects/stdobjects.h>
  35. #include <objects/collhash.h>
  36. #include <objects/Coding.h>
  37. #include <objects/Coder.h>
  38.  
  39. @interface Collection : Object <Collecting, Coding>
  40. {
  41. }
  42.  
  43. + initialize;
  44.  
  45. - printElement: (elt)anElement;
  46. - printForDebugger;
  47.  
  48. @end
  49.  
  50. // #warning fix this macro
  51. #define FOR_COLL(ACOLL, ELT) \
  52. { \
  53.    void *_es = [ACOLL initEnumState]; \
  54.    while ([ACOLL getNextElement:&(ELT) withEnumState:&_es]) \
  55.      {
  56.  
  57. #define FOR_COLL_END \
  58.      } \
  59.    [ACOLL freeEnumState:_es]; \
  60. }
  61.  
  62. /* The only subclassResponsibilities in Collection are:
  63.  
  64.       addElement:
  65.       removeElement:
  66.       getNextElement:withEnumState:
  67.       empty
  68.  
  69.    But subclasses may need to override the following for correctness:
  70.  
  71.       contentType
  72.       comparisonFunction
  73.  
  74.    but subclasses will want to override others as well in order to 
  75.    increase efficiency, especially:
  76.  
  77.       count
  78.  
  79.    and perhaps:
  80.  
  81.       includesElement:
  82.       occurrencesOfElement:
  83.       uniqueContents
  84.       withElementsCall:whileTrue:
  85.       withElementsCall:
  86.       isEmpty
  87.       freeObjects
  88.  
  89. */
  90.  
  91. #endif /* __Collection_h_INCLUDE_GNU */
  92.  
  93.